package guoanmaker.operator.business.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import guoanmaker.operator.business.model.OperatorActivityApplication;
import guoanmaker.operator.business.service.OperatorActivityApplicationServiceInterface;
import guoanmaker.operator.helper.common.AjaxJson;
import guoanmaker.operator.helper.common.abstractobj.ApiController;
import io.swagger.annotations.ApiOperation;

/**
 *  
 *
 * @author wanghongwei 
 * @ClassName: OperatorActivityApplicationController
 * @Description: OperatorActivityApplicationController 
 * @date 2017/8/10 下午14:05 
 */
@RestController
@RequestMapping(ApiController.OPERATOR_ACTIVITY_APPLICATION)
public class OperatorActivityApplicationController{
	private final AjaxJson ajaxJson;
	@Autowired
	private final OperatorActivityApplicationServiceInterface operatorActivityApplicationListServiceInterface;
	
	 public OperatorActivityApplicationController(AjaxJson ajaxJson, OperatorActivityApplicationServiceInterface operatorActivityApplicationServiceInterface) {
	        this.ajaxJson = ajaxJson;
	       this.operatorActivityApplicationListServiceInterface=operatorActivityApplicationServiceInterface;
	    }
	   /** 
	    * @Title: saveActivityApplication
	    * @Description: 保存报名列表
	    * @param: OperatorActivityApplication   
	    * @return AjaxJson    
	    * @throws 
	    */
	    @ApiOperation(value = "保存报名表单", notes = "新增/修改报名表单")
	    @PostMapping(value = "saveActivityApplication")
	    public AjaxJson saveActivityApplication(@RequestBody OperatorActivityApplication operatorActivityApplication) {
	        return ajaxJson.setSuccess(true).setStatus(200).setData(operatorActivityApplicationListServiceInterface.saveActivityApplication(operatorActivityApplication));
	    }
	    /** 
		    * @Title: getActivityApplicationById
		    * @Description: 保存报名列表
		    * @param: OperatorActivityApplication   
		    * @return AjaxJson    
		    * @throws 
		    */
	    @ApiOperation(value = "根据活动Id查询报名表单", notes = "根据活动Id查询报名表单")
	    @PostMapping(value = "getActivityApplicationById")
	    public AjaxJson getActivityApplicationById(@RequestParam(value = "id") String id) {
	        return ajaxJson.setSuccess(true).setStatus(200).setData(operatorActivityApplicationListServiceInterface.getActivityApplicationById(id));
	    }
	    /** 
		    * @Title: getActivityApplicationById
		    * @Description: 删除报名列表
		    * @param: OperatorActivityApplication   
		    * @return AjaxJson    
		    * @throws 
		    */
	    @ApiOperation(value ="根据报名列表id删除报名表单", notes = "根据报名列表id删除报名表单")
	    @PostMapping(value = "deleteActivityApplicationById")
	    public AjaxJson deleteActivityApplicationById(@RequestParam(value = "id") String id) {
	    	operatorActivityApplicationListServiceInterface.deleteActivityApplicationById(id);
	        return ajaxJson.setSuccess(true).setStatus(200).setData("数据删除成功!");
	    }
	    /** 
		    * @Title: deleteAllActivityApplicationById
		    * @Description: 删除所有报名列表
		    * @param: OperatorActivityApplication   
		    * @return AjaxJson    
		    * @throws 
		    */
	    @ApiOperation(value ="根据活动id删除所有报名表单", notes = "根据活动id删除所有报名表单")
	    @PostMapping(value = "deleteAllActivityApplicationById")
	    public AjaxJson deleteAllActivityApplicationById(@RequestParam(value = "id") String id) {
	    	operatorActivityApplicationListServiceInterface.deleteAllActivityApplicationById(id);
	        return ajaxJson.setSuccess(true).setStatus(200).setData("数据删除成功!");
	    }

}
